{% extends "manager.html" %}
{% block body %}
<div class="table-responsive w90">
<table id="main" class="table table-striped table-bordered table-hover">
<thead>
<tr>
<td>文章ID</td>
<td>主题</td>
<td>创建时间</td>
<td>類別</td>
<td>管理</td>
</tr>
</thread>
<tbody>
{% if not LIST %}
	<tr><td><a href="/edit?TYPE=ADD" class="btn btn-success"><span class="glyphicon glyphicon-plus"></span>沒有文章，点此新建？</a></td></tr>
{% else %}
	{% for i in LIST %}
		<tr>
		<td>{{i[0]}}</td>
		<td>{{i[1]}}</td>
		<td>{{i[2]}}</td>
		<td>{{i[3]}}</td>
		<td>
		<button onclick="del({{i[0]}},'{{i[1]}}')" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span>刪除</button>
		<a href="/edit?TYPE=ADD" class="btn btn-success"><span class="glyphicon glyphicon-plus"></span>新建</a>
		<a href="/edit?id={{i[0]}}&TYPE=EDIT" class="btn btn-primary"><span class="glyphicon glyphicon-edit"></span>编辑</button>
		</td>
		</tr>
	{% end %}
{% end %}
</tbody>
</table>
</div>
{% end %}
{% block js %}
<script>
function del(id,subject){
var msg="確定要刪除" +subject+"嗎？\n注意：刪除后將無法恢復！"
if (confirm(msg)){
	$.get("del",{ID:id},function(data){if (data=="0"){alert("文章已成功刪除！");} else {alert(data);}})
	}
}
</script>
{% end %}